#include "QPIData.h"



Trajectory::Trajectory()
{
}


Trajectory::~Trajectory()
{
	for(list<Transition>::iterator it = theList.begin(); it != theList.end(); it++)
		(*it).clear(); 
}

void Transition::print(FILE *f)
{
	for(unsigned int i=0; i< state->numInts; i++)
		fprintf(f, "%d ", state->intArray[i]); 

	for(unsigned int i=0; i< state->numDoubles; i++)
		fprintf(f, "%lf ", state->doubleArray[i]); 

	for(unsigned int i=0; i< state->numChars; i++)
		fprintf(f, "%c ", state->charArray[i]); 


	//action: 
	for(unsigned int i=0; i< action->numInts; i++)
		fprintf(f, "%d ", action->intArray[i]); 

	for(unsigned int i=0; i< action->numDoubles; i++)
		fprintf(f, "%lf ", action->doubleArray[i]); 

	for(unsigned int i=0; i< action->numChars; i++)
		fprintf(f, "%c ", action->charArray[i]); 

	//pi action 
	for(unsigned int i=0; i< piAction->numInts; i++)
		fprintf(f, "%d ", piAction->intArray[i]); 

	for(unsigned int i=0; i< piAction->numDoubles; i++)
		fprintf(f, "%lf ", piAction->doubleArray[i]); 

	for(unsigned int i=0; i< piAction->numChars; i++)
		fprintf(f, "%c ", piAction->charArray[i]); 


	fprintf(f, "%lf \t", reward); 


	//next state 
	for(unsigned int i=0; i< nextstate->numInts; i++)
		fprintf(f, "%d ", nextstate->intArray[i]); 

	for(unsigned int i=0; i< nextstate->numDoubles; i++)
		fprintf(f, "%lf ", nextstate->doubleArray[i]); 

	for(unsigned int i=0; i< nextstate->numChars; i++)
		fprintf(f, "%c ", nextstate->charArray[i]); 


	fprintf(f,"\n"); 
}

void Transition::printInfo(FILE *f)
{
	fprintf(f, "%d %d %d %d %d %d\n", state->numInts, state->numDoubles, state->numChars, action->numInts, action->numDoubles, action->numChars); 
}
